const request = require('request-promise-native');

(async () => {
	let items = [{
		movieId: 26799232,
		title: '西小河的夏天',
		rate: 6,
		poster: 'https://img3.doubanio.com/view/photo/l_ratio_poster/public/p2522331711.jpg'
	},
		{
			movieId: 26752852,
			title: '水形物语',
			rate: 7,
			poster: 'https://img1.doubanio.com/view/photo/l_ratio_poster/public/p2515650989.jpg'
		}];

	for (let item of items) {
		let result = await fetchMovie(item.movieId);

		try {

			result = JSON.parse(result);
			console.log(result.summary)

		} catch (err) {
			console.log(err)
		}

	}

})();

async function fetchMovie(id) {
	let url = `https://api.douban.com/v2/movie/subject/${id}`;
	let result = await request(url);

	return result;
}